<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>长沙国王陵遗址信息管理系统</title>
<script type="text/javascript" src="${path}/js/scripts/bootstart.js"></script>
<link rel="icon" href="${path}/imgs/logo.png" type="image/x-icon" />
<link rel="shortcut icon" href="${path}/imgs/logo.png"
	type="image/x-icon" />
<style type="text/css">
body {
	margin: 0;
	padding: 0;
	border: 0;
	width: 100%;
	height: 100%;
	overflow: hidden;
	background-color: #EAF6F9;
}

.header {
	height: 80px;
	overflow: hidden;
	position: absolute;
	top: 0;
	width: 100%;
	z-index: 30;
}

#updateWin table td {
	font-family: Tahoma, Verdana, 宋体;
	font-size: 9pt;
}

<!--
body {
	font-size: 20px;
}

-->
.bottom_div {
	background: url("${path}/imgs/bottom_bg.gif") repeat-x scroll 0 0
		rgba(0, 0, 0, 0);
	clear: both;
	color: #8fcfff;
	height: 24px;
	line-height: 24px;
	margin: 0 6px;
	text-align: center;
	z-index: 100;
}

.mini-tree-nodetext {
	font-size: 16px;
	font-family: '微软雅黑';
}

.mini-outlookbar-groupTitle {
	font-size: 16px;
	font-family: '微软雅黑';
}

.mini-tree-leaf {
	background: url("${path}/js/scripts/miniui/themes/icons/node.png");
}

.mini-tree-nodetitle {
	margin-top: 5px;
}

.mini-tree-nodetitle {
	margin-left: 20px;
}
</style>
</head>
<body>
	<div id="layout1" class="mini-layout"
		style="width: 100%; height: 100%; background: #1362ae;">
		<div class="header" region="north" showSplit="false"
			showHeader="false">
			<img alt="" src="${path}/imgs/top_bg.png" height="100%" width="100%">
			<div
				style="float: left; width: 500px; height: 60px; position: absolute; top: 5px; left: 10px;">
				<img alt="" src="${path}/imgs/logo.png" width="60" height="60px" style="margin-left: 20px;">
				<font style="position: absolute;font-size: 20px;margin-top: 20px;">长沙国王陵遗址信息管理系统</font>
			</div>
			<div
				style="float: left; width: 400px; padding: 15px; position: absolute; top: 5px; right: 400px;">
				<span> 今天<span id="week"></span>&nbsp;&nbsp;<span id="time"></span>
				</span> <br /> <span> <span id="call"></span>:&nbsp;${loginInfo.jobNo}
					&nbsp;&nbsp; 角色:&nbsp;${loginInfo.roleName}
				</span>
				<script type="text/javascript" src="${path}/js/scripts/showDate.js"></script>
			</div>
			<div style="position: absolute; top: 18px; right: 10px;">
				<a class="mini-button" iconCls="icon-edit"
					onclick="winmenu.showUpdateUser" plain="true">修改密码</a> <a
					class="mini-button" iconCls="icon-redo" onclick="onExit()"
					plain="true">安全退出</a>
			</div>
		</div>
		<div title="center" region="center"
			style="border: 0; margin-left: 5px;" bodyStyle="overflow:hidden;">
			<div class="mini-splitter" style="width: 100%; height: 100%;"
				borderStyle="border:0;">
				<div size="200" maxSize="250" minSize="100"
					showCollapseButton="true" style="border: 0; background: #F9FBFC;">
					<div id="leftTree" class="mini-outlooktree"
						url="${path}/resource/mgr/showResourceMenu" dataField="list"
						onnodeclick="winmenu.onItemSelect" idField="sourceId"
						parentField="parentId" textField="sourceName"
						borderStyle="border:0"></div>
				</div>
				<div showCollapseButton="false" style="border: 0;">
					<div id="mainTabs" class="mini-tabs" activeIndex="0"
						style="width: 100%; height: 100%;" plain="false">
						<div title="首页" url="${path}/mgr/index"
							style="width: 100%; height: 100%;"></div>
					</div>
				</div>
			</div>
		</div>
		<div class="bottom_div" title="south" region="south" showSplit="false"
			showHeader="false" height="30">
			<div
				style="line-height: 28px; text-align: center; cursor: default; border: 0px;">
				Copyright &copy; 长沙国王陵遗址公园</div>
		</div>
	</div>
	<div id="updateWin" class="mini-window" title="当前用户修改密码"
		style="width: 450px; height: 300px;" showModal="true"
		allowResize="false" allowDrag="true">
		<form id="updateForm" method="post">
			<input name="userId" class="mini-hidden" value="${loginInfo.userId}" />
			<fieldset style="border: solid 1px #aaa; padding: 3px;">
				<legend> 修改密码信息 </legend>
				<div style="padding: 5px">
					<table>
						<tr>
							<td style="width: 70px;" align="right">登录名:</td>
							<td style="width: 250px;"><input name="jobNo"
								value="${loginInfo.jobNo}" class="mini-textbox"
								allowInput="false" style="width: 100%" /></td>
						</tr>
						<tr>
							<td style="width: 70px;" align="right">原始密码:</td>
							<td style="width: 250px;"><input name="oldpwd"
								class="mini-password" required="true" id="pwd"
								style="width: 100%" /></td>
						</tr>
						<tr>
							<td style="width: 70px;" align="right">密码:</td>
							<td style="width: 250px;"><input name="password"
								class="mini-password" required="true" id="pwd"
								vtype="minLength:6" style="width: 100%" /></td>
						</tr>
						<tr>
							<td style="width: 70px;" align="right">确认密码:</td>
							<td style="width: 250px;"><input class="mini-password"
								required="true" id="repwd" onvalidation="winmenu.validPwd"
								vtype="minLength:6" style="width: 100%" /></td>
						</tr>
					</table>
				</div>
			</fieldset>
			<div style="text-align: center; padding: 10px;">
				<a class="mini-button" onclick="winmenu.updatepwd"
					style="width: 60px; margin-right: 20px;">保存</a> <a
					class="mini-button" onclick="winmenu.closeUpdateWin"
					style="width: 60px;">取消</a>
			</div>
		</form>
	</div>
	<script type="text/javascript" src="${path}/js/scripts/utils.js"></script>
	<script type="text/javascript">
		$(function() {
			mini.parse();
			var leftTree = mini.get("leftTree");
			if (leftTree.getList().length == 0) {
				mini.alert("当前登录用戶对应角色没有分配资源,请联系系统管理员!");
				return;
			}
			var item;
			var showTab = function(config) {
				var tabs = mini.get(config.id);
				var id = "tab$" + config.itemid;
				var tab = tabs.getTab(id);
				if (!tab) {
					tab = {};
					tab.name = id;
					tab.title = config.itemtext;
					tab.showCloseButton = true;
					//这里拼接了url，实际项目，应该从后台直接获得完整的url地址
					var url = config.url;
					if (url.indexOf("?") == -1) {
						url += "?";
					} else {
						url += "&";
					}
					url += "sourceid=" + item.sourceId;
					//mini.alert(item.sourceid);
					tab.url = url;
					tabs.addTab(tab);
				}
				tabs.activeTab(tab);
			};

			window.winmenu = {};
			winmenu.onItemSelect = function(e) {
				item = e.node;
				var url = item.path;
				if (!url) {
					return;
				}
				if (url.indexOf("http") == -1) {
					url = "${path}" + item.path;
				}
				showTab({
					id : "mainTabs",
					itemid : item.sourceId,
					itemtext : item.sourceName,
					url : url
				});
			};
			var win = mini.get("updateWin");
			winmenu.showUpdateUser = function() {
				var updateForm = new mini.Form("updateForm");
				updateForm.reset();
				win.show();
			};

			winmenu.closeUpdateWin = function() {
				win.hide();
			};

			//确认密码验证
			winmenu.validPwd = function(e) {
				var pwd = mini.get("pwd").getValue();
				if (e.value != pwd) {
					e.errorText = "两次密码输入不一致！";
					e.isValid = false;

					return false;
				}

				return true;
			};

			//修改密码
			winmenu.updatepwd = function() {
				var updateForm = new mini.Form("updateForm");
				//验证表单
				updateForm.validate();
				if (!updateForm.isValid()) {
					return;
				}
				var repwd = mini.get("repwd");
				if (!winmenu.validPwd(repwd)) {
					return;
				}
				//获取表单对象信息
				var obj = updateForm.getData();
				var paramData = myutils.parseFormDataToParam(obj);
				$.ajax({
					type : "post",
					cache : false,
					async : false,//同步请求
					url : "${path}/user/mgr/updatePwd",
					data : paramData,
					success : function(json) {
						if (json == "03") {
							mini.alert("密码修改成功！");
							mini.get("pwd").setValue("");
							mini.get("repwd").setValue("");
							win.hide();
						} else if (json == "01") {
							mini.alert("用户信息错误！");
						} else if (json == "02") {
							mini.alert("原始密码错误！");
						} else if (json == "04") {
							mini.alert("系统异常！");
						}
					}
				});
			};
		});
		//退出系统
		function onExit() {
			mini.confirm("您确定退出本系统吗?", "温馨提示", function(e) {
				if (e == "ok") {
					document.location = "${path}/user/mgr/exit";
				}
			});
		};
	</script>
</body>
</html>